package com.example.producer;

import com.example.producer.service.RabbitProducer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.concurrent.TimeUnit;

@Component
public class ScheduledTasks {
    @Autowired
    private RabbitProducer rabbitProducer;

    @Scheduled(fixedRate = 1, timeUnit = TimeUnit.HOURS)
    public void produce() {
        for (int i = 0; i < 100; i++) {
            rabbitProducer.produce();
        }
    }
}
